<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreBargainUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_bargain_users', function (Blueprint $table) {
            $table->id()->comment('用户参与砍价表');
            $table->integer('bargain_id')->comment('砍价商品ID')->index();
            $table->integer('user_id')->comment('用户ID')->index();
            $table->decimal('bargain_price_min',8,2)->comment('砍价的最低价');
            $table->decimal('bargain_price',8,2)->comment('砍价金额');
            $table->decimal('price',8,2)->comment('砍掉的价格');
            $table->string('status',32)->default('participating')->comment('状态 participating:进行中 endOfActivitySuccess 已成功 endOfActivityFail 已失败');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_bargain_users');
    }
}
